package com.tanhua.domain.vo;

import lombok.Builder;
import lombok.Data;

import java.io.Serializable;

@Data
@Builder
public class PicUploadResult implements Serializable {

    // 文件唯一标识
    private String uid;
    // 文件名
    private String name;
    // 状态有：uploading done error removed
    private String status;
    // 服务端响应内容，如：'{"status": "success"}'
    private String response;

    public static PicUploadResult error() {
        return PicUploadResult.builder().status("error").build();
    }

    public static PicUploadResult ok(String path) {
        return PicUploadResult.builder()
                .status("done")
                .uid(String.valueOf(System.currentTimeMillis()))
                .name(path)
                .build();
    }
}
